<template>
  <div class="main">
    <div class="lefttwo">
      <div class="kytj">
        <div class="title">客源统计</div>
        <div style="margin-top: 28px" class="yqpxlb">
          <div class="yqxlln">
            <div class="yqpie" id="yqpie"></div>
            <div class="yqtitle">福建</div>
          </div>
          <div class="yqxlln">
            <div class="yqpie" id="yqpie1"></div>
            <div class="yqtitle">广东</div>
          </div>
          <div class="yqxlln">
            <div class="yqpie" id="yqpie2"></div>
            <div class="yqtitle">广西</div>
          </div>
        </div>
        <div class="ykcftj">游客来源统计</div>
        <div id="yklytjchart"></div>
      </div>
      <div class="ykcf" style="position: relative">
        <div class="title">游客成分</div>
        <div class="yknlcf">游客年龄成分</div>
        <div id="oldchart"></div>
        <div class="yknlcf" style="position: absolute; top: 200px">
          游客男女比例
        </div>
        <div id="oldchart1"></div>
      </div>
    </div>
  </div>
</template>
<script>
import * as echarts from "echarts";
// import "echarts/map/js/china.js";
export default {
  components: {},
  watch: {},
  created() {},
  data() {
    return {
      activeName: "1",
    };
  },
  mounted() {
    this.getdata3();
    this.getdata31();
    this.getdata32();
    this.getdata1();
    this.getdata2();
    this.getdata22();
    this.getdata0();
    this.getdata6();
    this.getdata7();
  },
  methods: {
    getdata7() {
      const chartDom = document.getElementById("whchart1");
      const myChart = echarts.init(chartDom);
      let option;

      option = {
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "cross",
            crossStyle: {
              color: "#999",
            },
          },
        },

        legend: {
          textStyle: {
            color: "#fff",
          },
          icon: "circle",
        },
        xAxis: [
          {
            type: "category",
            axisLabel: {
              color: "#fff",
            },
            data: [
              "08:00",
              "10:00",
              "12:00",
              "14:00",
              "16:00",
              "18:00",
              "20:00",
            ],
            axisPointer: {
              type: "shadow",
            },
          },
        ],
        yAxis: [
          {
            type: "value",

            min: 0,
            max: 250,
            interval: 50,
            axisLabel: {
              formatter: "{value} ",
              color: "#fff",
            },
          },
          {
            type: "value",

            min: 0,
            max: 25,
            interval: 5,
            axisLabel: {
              formatter: "{value} %",
              color: "#fff",
            },
          },
        ],
        series: [
          {
            name: "今日",
            type: "line",
            yAxisIndex: 1,
            color: "#F37170",
            tooltip: {
              valueFormatter: function (value) {
                return value + " °C";
              },
            },
            data: [
              23.0, 16.5, 12.0, 6.2, 2.0, 20.3, 23.4, 2.2, 3.3, 4.5, 6.3, 10.2,
              20.3, 23.4,
            ],
          },
          {
            name: "昨日",
            type: "line",
            yAxisIndex: 1,
            color: "#FFC17C",
            tooltip: {
              valueFormatter: function (value) {
                return value + " °C";
              },
            },
            data: [
              2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2,
            ],
          },
        ],
      };
      option && myChart.setOption(option);
    },
    getdata0() {
      const chartDom = document.getElementById("whchart0");
      const myChart = echarts.init(chartDom);
      let option;

      option = {
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "cross",
            crossStyle: {
              color: "#999",
            },
          },
        },

        xAxis: [
          {
            type: "category",
            axisLabel: {
              color: "#fff",
            },
            data: [
              "08:00",
              "10:00",
              "12:00",
              "14:00",
              "16:00",
              "18:00",
              "20:00",
            ],
            axisPointer: {
              type: "shadow",
            },
          },
        ],
        yAxis: [
          {
            type: "value",

            min: 0,
            max: 250,
            interval: 50,
            axisLabel: {
              formatter: "{value} ",
              color: "#fff",
            },
          },
          {
            type: "value",

            min: 0,
            max: 25,
            interval: 5,
            axisLabel: {
              formatter: "{value} %",
              color: "#fff",
            },
          },
        ],
        series: [
          {
            name: "同比",
            type: "line",
            yAxisIndex: 1,
            color: "#FF7575",
            tooltip: {
              valueFormatter: function (value) {
                return value + " °C";
              },
            },
            data: [
              2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2,
            ],
          },
        ],
      };
      option && myChart.setOption(option);
    },

    getdata6() {
      const chartDom = document.getElementById("whchart");
      const myChart = echarts.init(chartDom);
      let option;

      option = {
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "cross",
            crossStyle: {
              color: "#999",
            },
          },
        },

        legend: {
          textStyle: {
            color: "#fff",
          },
          icon: "circle",
        },
        xAxis: [
          {
            type: "category",
            axisLabel: {
              color: "#fff",
            },
            data: [
              "08:00",
              "10:00",
              "12:00",
              "14:00",
              "16:00",
              "18:00",
              "20:00",
            ],
            axisPointer: {
              type: "shadow",
            },
          },
        ],
        yAxis: [
          {
            type: "value",

            min: 0,
            max: 250,
            interval: 50,
            axisLabel: {
              formatter: "{value} ",
              color: "#fff",
            },
          },
          {
            type: "value",

            min: 0,
            max: 25,
            interval: 5,
            axisLabel: {
              formatter: "{value} %",
              color: "#fff",
            },
          },
        ],
        series: [
          {
            name: "今日",
            type: "line",
            yAxisIndex: 1,
            color: "#FF7575",
            tooltip: {
              valueFormatter: function (value) {
                return value + " °C";
              },
            },
            data: [
              2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2,
            ],
          },
          {
            name: "昨日",
            type: "line",
            yAxisIndex: 1,
            color: "#06d1ce",
            tooltip: {
              valueFormatter: function (value) {
                return value + " °C";
              },
            },
            data: [
              23.4, 23.0, 16.5, 12.0, 6.2, 2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3,
            ],
          },
        ],
      };
      option && myChart.setOption(option);
    },

    getdata22() {
      const chartDom = document.getElementById("oldchart1");
      const myChart = echarts.init(chartDom);
      let option;
      const img =
        "";
      var sexData = [
        {
          name: "男性",
          value: 30,
        },
        {
          name: "女性",
          value: 10,
        },
      ];

      let sum = sexData.reduce((prev, curr) => prev + curr.value, 0);
      let start = 180 - (sexData[0].value / sum - 0.04) * 180;
      var data = [];
      var color = ["#22F1FA", "#FF2F60"];
      for (var i = 0; i < sexData.length; i++) {
        data.push(
          {
            value: sexData[i].value,
            name: sexData[i].name,
            itemStyle: {
              normal: {
                borderWidth: 4,
                borderColor: color[i],
              },
            },
          },
          {
            value: sum * 0.04,
            name: "",
            itemStyle: {
              normal: {
                label: {
                  show: false,
                },
                labelLine: {
                  show: false,
                },
                color: "rgba(0, 0, 0, 0)",
                borderColor: "rgba(0, 0, 0, 0)",
                borderWidth: 0,
              },
            },
          }
        );
      }
      option = {
        // backgroundColor: "#0A2E5D",
        color: color,
        graphic: {
          elements: [
            {
              type: "image",
              z: 1,
              style: {
                image: img,
                width: 110,
                height: 110,
              },
              left: "center",
              top: "center",
            },
          ],
        },
        tooltip: {
          show: true,
          formatter: "{b}：{d}%",
        },
        toolbox: {
          show: false,
        },
        series: [
          {
            name: "",
            type: "pie",
            clockWise: false,
            radius: [62, 65],
            startAngle: start,
            hoverAnimation: false,
            itemStyle: {
              normal: {
                label: {
                  show: true,
                  position: [0, -10],
                  color: "#ddd",
                  formatter: function (params) {
                    var percent = ((params.value / sum) * 100).toFixed(0);
                    if (params.name !== "") {
                      return params.name + "：" + params.value + "";
                    } else {
                      return "";
                    }
                  },
                },
                labelLine: {
                  length: 30,
                  length2: 50,
                  show: true,
                  color: "#00ffff",
                },
              },
            },
            data: data,
            z: 2,
          },
        ],
      };

      option && myChart.setOption(option);
    },

    getdata2() {
      const chartDom = document.getElementById("oldchart");
      const myChart = echarts.init(chartDom);
      let option;

      option = {
        grid: {
          // left: 0,
          // right: 0,
          top: "5%",
          bottom: "15%",
        },
        tooltip: {
          trigger: "item",
        },
        title: {
          text: "年龄分布图",
          left: "center",
          bottom: "30%",
          textStyle: {
            fontSize: 13,
            color: "#fff",
          },
        },
        color: ["#2AF7D9", "#348CFA", "#B073F2", "#FF7D4A"],
        series: [
          {
            // name: "Access From",
            type: "pie",
            radius: ["50%", "90%"],
            center: ["50%", "70%"],
            avoidLabelOverlap: false,
            // adjust the start and end angle
            startAngle: 180,
            label: {
              color: "#fff",
            },

            data: [
              { value: 10, name: "20-30岁" },
              { value: 10, name: "30-40岁" },
              { value: 10, name: "40-50岁" },
              { value: 20, name: "50-60岁" },
              {
                value: 50,
                name: "",
                itemStyle: {
                  color: "transparent",
                },
                label: {
                  show: false,
                },
              },
            ],
          },
        ],
      };
      option && myChart.setOption(option);
    },
    getdata1() {
      const chartDom = document.getElementById("yklytjchart");
      const myChart = echarts.init(chartDom);
      let option;

      option = {
        tooltip: {
          trigger: "axis",
          axisPointer: {
            // Use axis to trigger tooltip
            type: "shadow", // 'shadow' as default; can also be 'line' or 'shadow'
          },
        },

        grid: {
          left: "3%",
          right: "4%",
          bottom: "3%",
          top: "0%",
          containLabel: true,
        },
        xAxis: {
          type: "value",
          axisLabel: {
            color: "#fff",
          },
        },
        yAxis: {
          type: "category",
          data: [
            "广东省",
            "福建省",
            "广西省",
            "山东省",
            "江苏省",
            "河北省",
            "辽宁省",
          ],
          axisLabel: {
            color: "#fff",
          },
        },
        series: [
          {
            name: "Direct",
            type: "bar",
            barWidth: "15",
            color: "#4af3ff",
            emphasis: {
              focus: "series",
            },
            itemStyle: {
              barBorderRadius: 4, // 柱子的圆角
            },
            data: [320, 302, 301, 334, 390, 330, 320],
          },
        ],
      };
      option && myChart.setOption(option);
    },
    getdata32() {
      const chartDom = document.getElementById("yqpie2");
      const myChart = echarts.init(chartDom);
      let option;

      option = {
        tooltip: {
          trigger: "item",
        },
        legend: {
          show: false,
        },
        series: [
          {
            type: "pie",
            radius: ["70%", "90%"],
            avoidLabelOverlap: false,
            label: {
              show: true,
              position: "center",
              color: "#4af3ff",
              textStyle: {
                fontSize: 25, // 字体大小
                lineHeight: 60, // 行高设置为30px
              },

              fontWeight: "bold",
              formatter: function (e) {
                return `15%`;
              },
            },

            labelLine: {
              show: false,
            },
            color: ["#616a5c", "#1ae8c6"],
            data: [
              { value: 1048, name: "总数" },
              { value: 735, name: "未处理" },
            ],
          },
        ],
      };
      option && myChart.setOption(option);
    },
    getdata31() {
      const chartDom = document.getElementById("yqpie1");
      const myChart = echarts.init(chartDom);
      let option;

      option = {
        tooltip: {
          trigger: "item",
        },
        legend: {
          show: false,
        },
        series: [
          {
            type: "pie",
            radius: ["70%", "90%"],
            avoidLabelOverlap: false,
            label: {
              show: true,
              position: "center",
              color: "#4af3ff",
              textStyle: {
                fontSize: 25, // 字体大小
                lineHeight: 60, // 行高设置为30px
              },

              fontWeight: "bold",
              formatter: function (e) {
                return `15%`;
              },
            },

            labelLine: {
              show: false,
            },
            color: ["#616a5c", "#1ae8c6"],
            data: [
              { value: 1048, name: "总数" },
              { value: 735, name: "未处理" },
            ],
          },
        ],
      };
      option && myChart.setOption(option);
    },
    getdata3() {
      const chartDom = document.getElementById("yqpie");
      const myChart = echarts.init(chartDom);
      let option;

      option = {
        tooltip: {
          trigger: "item",
        },
        legend: {
          show: false,
        },
        series: [
          {
            type: "pie",
            radius: ["70%", "90%"],
            avoidLabelOverlap: false,
            label: {
              show: true,
              position: "center",
              color: "#4af3ff",
              textStyle: {
                fontSize: 25, // 字体大小
                lineHeight: 60, // 行高设置为30px
              },

              fontWeight: "bold",
              formatter: function (e) {
                return `15%`;
              },
            },

            labelLine: {
              show: false,
            },
            color: ["#616a5c", "#1ae8c6"],
            data: [
              { value: 1048, name: "总数" },
              { value: 735, name: "未处理" },
            ],
          },
        ],
      };
      option && myChart.setOption(option);
    },
  },
};
</script>
<style scoped>
#whchart1 {
  width: 100%;
  height: 257px;
}
#whchart {
  width: 100%;
  height: 257px;
}
#whchart0 {
  width: 100%;
  height: 257px;
}
.ljtitle {
  padding-left: 10px;
  box-sizing: border-box;
  color: #fff;
}
.whcg {
  width: 100%;
  height: 307px;
  margin-top: 17px;
  background: rgba(3, 8, 13, 0.6);
  border-radius: 8px;
  padding: 15px;

  box-sizing: border-box;
}
.whcsimg img {
  width: 100%;
  height: 100%;
}
.whcsnum {
  width: calc(100% - 74px);
  height: auto;
  padding-top: 25px;
  float: left;
  box-sizing: border-box;
}
.whcsimg {
  width: 74px;
  height: 102px;
  float: left;
}
.whcs:nth-child(2n) {
  margin-right: 0px !important;
  margin-bottom: 0px !important;
}
.whcs {
  width: 191px;
  height: 102px;
  margin-right: 5px;
  overflow: hidden;
  float: left;
  padding: 5px;
  box-sizing: border-box;
  background: #0a100c;
  margin-bottom: 10px;
}
.kljclist {
  width: 100%;
  height: auto;
  margin-top: 18px;
  overflow: hidden;
}
.jdrzchart {
  width: 100%;
  height: 237px;
  /* margin-top: 23px; */
}
#jdrzlchart {
  width: 90px;
  height: 90px;
}
.jdtotal {
  width: 137px;
  height: 81px;
  border-radius: 10px;
  line-height: 81px;
  text-align: center;
  font-size: 60px;
  font-weight: bold;
  color: #01ffff;
  background: #1d443b;
}
.jdrzlabel {
  color: #fff;
  text-align: left;
  margin-bottom: 10px;
}
.jdrzlist {
  width: 50%;
  float: left;
  height: auto;
}
.jdrznyum {
  width: 100%;
  height: auto;
  margin-top: 18px;
  overflow: hidden;
}
.jdrzl {
  margin-top: 18px;
  width: 100%;
  height: 404px;
  background: rgba(3, 8, 13, 0.6);
  border-radius: 8px;
  padding: 15px;

  box-sizing: border-box;
}
.whcskljc {
  width: 100%;
  height: 305px;
  background: rgba(3, 8, 13, 0.6);
  border-radius: 8px;
  padding: 15px;

  box-sizing: border-box;
}
.colnum span {
  font-size: 30px;
  font-weight: bold;
  color: #297bf7;
  font-style: italic;
}
.colnum {
  color: #fff;
  font-size: 14px;
  text-align: center;
}
.colltitle {
  text-align: center;
  color: #fff;
}
.colls {
  width: 33.3%;
  height: auto;
  float: left;
}
.collslist {
  margin-top: 32px;
  width: 100%;
  height: auto;
  overflow: hidden;
}
.bhd span {
  color: #01ffff;
}
.bhd {
  position: absolute;
  right: 120px;
}
.jrjq {
  width: 71px;
  height: 25px;
  color: #fff;
  float: right;
  position: absolute;
  background: #2a63e5;
  line-height: 25px;
  right: 25px;
  border-radius: 5px;
  text-align: center;
  background: #2a63e5;
}
.jqgk {
  width: 100%;
  height: 532px;
  background: rgba(3, 8, 13, 0.6);
  border-radius: 8px;
  padding: 15px;

  box-sizing: border-box;
}
.rightone {
  width: 421px;
  height: auto;
  margin-left: 19px;
  float: right;
}
#oldchart {
  width: 100%;
  height: 161px;
}
#oldchart1 {
  width: 100%;
  height: 141px;
}
.yknlcf {
  margin-top: 10px;
  text-align: left;
  color: #fff;
}
#yklytjchart {
  width: 100%;
  height: 316px;
}
.ykcftj {
  color: #fff;
  text-align: left;
  margin-top: 45px;
}
.yqtitle {
  font-size: 10px;
  margin-top: -37px;
  text-align: center;
  color: #eff0ef;
}
.yqpie {
  width: 100%;
  height: 100px;
}
.yqpxlb {
  width: 100%;
  height: auto;
  display: flex;
  justify-content: space-around;
}
.yqxlln {
  width: 33.3%;
  height: auto;
}
.ykcf {
  width: 100%;
  height: 405px;
  background: rgba(3, 8, 13, 0.6);
  border-radius: 8px;
  padding: 15px;
  margin-top: 16px;
  box-sizing: border-box;
}
.kytj {
  width: 100%;
  height: 533px;
  background: rgba(3, 8, 13, 0.6);
  border-radius: 8px;
  padding: 15px;
  box-sizing: border-box;
}
.lefttwo {
  width: 420px;
  height: auto;
  /* float: left; */
}
.ndimg img {
  width: 100%;
  height: 100%;
}
.ndimg {
  width: 100%;
  height: 94px;
}
.ndklfx {
  margin-top: 18px;
  margin-bottom: 10px;
  color: #fff;
}
.jcmapright div img {
  vertical-align: middle;
}
.jcmapright div {
  color: #fff;
}
.jcmapright {
  width: 40%;
  float: left;
}
.jcnum {
  display: inline-block;
  color: #fff;
}
.jcnum span {
  font-size: 20px;
  color: #4af3ff !important;
  font-weight: bold;
  font-style: italic;
}
.jcmapleft {
  width: 60%;
  height: auto;
  float: left;
}
.jcmap {
  width: 100%;
  height: auto;
  overflow: hidden;
  margin-top: 7px;
}
.kljc1 {
  margin-top: 15px;
  width: 100%;
  height: 521px;
  background: rgba(3, 8, 13, 0.6);
  border-radius: 8px;
  padding: 15px;
  box-sizing: border-box;
}

.numm1 {
  width: 50%;
  float: left;
}
.label {
  color: #fff;
  text-align: left;
}
.value span {
  font-size: 20px;
  color: #297bf7 !important;
  font-weight: bold;
  font-style: italic;
}
.value {
  color: #fff;
  text-align: left;
  margin-top: 5px;
}
.value1 span {
  font-size: 20px;
  color: #ff7d4a !important;
  font-weight: bold;
  font-style: italic;
}
.value1 {
  color: #fff;
  text-align: left;
  margin-top: 5px;
}
.numm {
  width: 100%;
  height: auto;
  margin-top: 16px;
  overflow: hidden;
}
.ryall span {
  font-size: 20px;
  color: #3abac0 !important;
  font-weight: bold;
  font-style: italic;
}
.ryall {
  margin-top: 25px;
  color: #fff;
}
.kljc {
  width: 100%;
  height: 419px;
  background: rgba(3, 8, 13, 0.6);
  border-radius: 8px;
  padding: 15px;
  box-sizing: border-box;
}
.leftone {
  width: 419px;
  height: auto;
  float: left;
}
.main {
  position: absolute;
  left: 22px;
  top: 90px;
  width: 420px;
}
.leftBxo {
  width: 23%;
  display: flex;
}

.rightBxo {
  width: 23%;
  display: flex;
}
.title {
  font-size: 24px;
  font-family: YouSheBiaoTiHei, YouSheBiaoTiHei-Regular;
  font-weight: 600;
  text-align: left;
  font-style: italic;
  color: #ffffff;
}
</style>
<style>
.collapseZdy .el-collapse-item__header {
  background-color: rgba(1, 255, 255, 0.16);
  border-radius: 3px 3px 0px 0px;
  font-size: 14px;
  font-family: Source Han Sans SC, Source Han Sans SC-Regular;
  font-weight: 400;
  text-align: left;
  color: #ffffff;
  padding-left: 6px;
  border-bottom: 3px solid #01ffff;
  position: relative;
  margin-bottom: 10px;
}
.collapseZdy {
  border-top: 1px solid transparent;
  border-bottom: 1px solid transparent;
}
.collapseZdy .el-collapse-item__wrap {
  background-color: transparent !important;
  border-bottom: none !important;
  color: #fff !important;
}
.collapseZdy .el-collapse-item__content {
  color: #fff !important;
  padding-bottom: 0;
}
.moren {
  padding: 6px 8px;
  height: 14px;
  background: rgba(255, 255, 255, 0.15);
  border: 0.5px solid #47b2b5;
  border-radius: 3px;
  box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(15px);
  font-size: 12px;
  font-family: AlibabaPuHuiTi-Regular;
  font-weight: normal;
  text-align: center;
  color: #ffffff;
  line-height: 14px;
  margin-left: 10px;
}
.active {
  background: #47b2b5;
  border: 1px solid #47b2b5;
  border-radius: 3px;
  box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(15px);
}
</style>
